# encoding=utf-8
# 处理接口响应（response）上下文


from common.writeYaml import write_data
from processingContext.replace import ReadYamlRender
from settings.settings import Route
from jsonpath import jsonpath


def context(response, source_path, target_path):
    """
    response:字典格式
    source_path:模板文件位置
    target_path:存放模板文件生成文件的位置
    """

    # 生成下一个接口的请求数据
    next_context = ReadYamlRender(source_path, response).render
    # 将请求数据写入 （测试用例）testcase 下的query.yaml文件中
    write_data(target_path, next_context)
